package com.cyanite.playlv2.widget;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.RelativeLayout.LayoutParams;

import java.util.ArrayList;

public class PhotoAdapter extends BaseAdapter   {

	private Context	mContext;
	private ArrayList<Bitmap> mBmps;

	public PhotoAdapter(Context c, ArrayList<Bitmap> list)  {
		mContext = c;
		mBmps = list;
	}

	public int getCount()  {
		return mBmps.size();
	}

	public Object getItem(int position)    {
		return position;
	}

	public long getItemId(int position)    {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent)  {
	    ImageView image = new ImageView(mContext);
	    image.setImageBitmap(mBmps.get(position));
	    image.setAdjustViewBounds(true);
	    image.setLayoutParams(new Gallery.LayoutParams(
                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        return image;
	}

}

